
const uidsKey = "node_uids"
const cacheNodeUids = uid =>{
    const ids = getCacheNodeUids();
    ids.push(uid)
    localStorage.setItem(uidsKey, JSON.stringify(ids))
}

export const cacheMarkdown = (uid, md) => {
  localStorage.setItem(uid, md);
  cacheNodeUids(uid)
};

export const getCacheMarkdown = (uid) => {
  return localStorage.getItem(uid) || "";
};

export const getCacheNodeUids = () => {
    const idsStr = localStorage.getItem(uidsKey)
    return idsStr ? JSON.parse(idsStr) : [];
}

export const clearAll = () => {
  localStorage.clear()
}